package com.robertbak.geolocation
{
	import com.robertbak.geolocation.interfaces.IAddress;
	import com.robertbak.geolocation.interfaces.ICoordinates;
	import com.robertbak.geolocation.interfaces.IPosition;

	public class GeoPosition implements IPosition
	{
		public function GeoPosition(O:Object = null)
		{						
			if (O!=null)
			{
				_timestamp = new Date(O.timestamp);
				_coordinates = new GeoCoordinates(O.coords);
				if (O.hasOwnProperty('gearsAddress'))
					_address = new GeoAddress(O.gearsAddress);
			}
		}

		private var _coordinates:GeoCoordinates;
		private var _address:GeoAddress;
		private var _timestamp  :Date;

		public function get coords():ICoordinates
		{
			return _coordinates;
		}
		
		public function get timestamp():Date
		{
			return _timestamp;
		}
		
		public function get address():IAddress
		{
			return _address;
		}
		
	}
}